package com.CNMedical.system.service.impl;

import java.util.List;

import com.diboot.core.service.impl.BaseServiceImpl;
import com.CNMedical.common.utils.DateUtils;
import org.springframework.stereotype.Service;
import com.CNMedical.system.mapper.AppletRotationMapper;
import com.CNMedical.system.domain.entity.AppletRotation;
import com.CNMedical.system.service.IAppletRotationService;

import javax.annotation.Resource;

/**
 * 轮播图Service业务层处理
 * 
 * @author tang
 * @date 2023-03-28
 */
@Service
public class AppletRotationServiceImpl extends BaseServiceImpl<AppletRotationMapper, AppletRotation> implements IAppletRotationService
{
    @Resource
    private AppletRotationMapper appletRotationMapper;

    @Override
    public List<AppletRotation> getAllRotation() {
        return lambdaQuery().list();
    }

    /**
     * 查询轮播图
     * 
     * @param id 轮播图主键
     * @return 轮播图
     */
    @Override
    public AppletRotation selectAppletRotationById(Long id)
    {
        return appletRotationMapper.selectAppletRotationById(id);
    }

    /**
     * 查询轮播图列表
     * 
     * @param appletRotation 轮播图
     * @return 轮播图
     */
    @Override
    public List<AppletRotation> selectAppletRotationList(AppletRotation appletRotation)
    {
        return appletRotationMapper.selectAppletRotationList(appletRotation);
    }

    /**
     * 新增轮播图
     * 
     * @param appletRotation 轮播图
     * @return 结果
     */
    @Override
    public int insertAppletRotation(AppletRotation appletRotation)
    {
        appletRotation.setCreateTime(DateUtils.getNowDate());
        return appletRotationMapper.insertAppletRotation(appletRotation);
    }

    /**
     * 修改轮播图
     * 
     * @param appletRotation 轮播图
     * @return 结果
     */
    @Override
    public int updateAppletRotation(AppletRotation appletRotation)
    {
        appletRotation.setUpdateTime(DateUtils.getNowDate());
        return appletRotationMapper.updateAppletRotation(appletRotation);
    }

    /**
     * 批量删除轮播图
     * 
     * @param ids 需要删除的轮播图主键
     * @return 结果
     */
    @Override
    public int deleteAppletRotationByIds(Long[] ids)
    {
        return appletRotationMapper.deleteAppletRotationByIds(ids);
    }

    /**
     * 删除轮播图信息
     * 
     * @param id 轮播图主键
     * @return 结果
     */
    @Override
    public int deleteAppletRotationById(Long id)
    {
        return appletRotationMapper.deleteAppletRotationById(id);
    }
}
